home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software of the Month Cl…Business) - New Member 21
/
Software of the Month Club XXI - New Member Business.ISO
/
mac
/
SOMCNMXXIBUS
/
DOS
/
BIZ
/
ASEASY
/
ASEASY.570
/
ASEASY.USR
< prev
Wrap
Text File
|
1995-07-03
|
8KB
|
246 lines
;---------------------------------------------------------------------------
; ** AS-EASY-AS ** External Functions Definition File
; Copyright 1995, TRIUS, Inc.
; TRIUS, Inc., P.O. Box 249, N. Andover, MA 01845-0249
; Tel. 508-794-9377, Fax. 508-688-6312, BBS. 508-794-0762
;---------------------------------------------------------------------------
; (1) Each function definition is made up of TWO lines as described below:
;
; 1st Line: Function_Name, Number_Of_Variables
; 2nd Line: Algebraic_Expression
;
; The expression can use any of the AS-EASY-AS built-in
; functions. The dynamic arguments of the external function
; are refferred to, in the definition, as @A(n), where n
; is an integer 1 to 10.
;
; ex. 1st line: ADD2NUM,2
; 2nd line: +@A(1)+@A(2)
;
; This function simply adds the two variables passed to it.
; So, if inc cell B10 of AS-EASY-AS, the user entered
; @ADD2NUM(2,6) the result would be 6.
;
; (2) The maximum number of functions that can be defined is 255.
;
; (3) The maximum Number of dynamic Variables that may be used in
; a function definition is: 10, i.e., a(1), a(2),...a(10).
;
; (4) Cell references SHOULD NOT be used in the function definition.
;
; (5) Any string to the right of a semicolon ";" is ignored. This permits
; the user to embed comments and function documentation information
; directly in this function definition file.
;
;---------------------------------------------------------------------------
; Sample Function Definitions
;---------------------------------------------------------------------------
;
; ADD1: Simple Function multiplies each of 3 argument by 10 and
; sums up the products. No internal functions used.
ADD1,3
+@a(1)*10+@a(2)*10+@a(3)*10
;
;
;
; SUB1: Multiply the First Argument by 100, multiply the second
; argument by 10 and then subtract the second product
; from the first. No internal functions used.
SUB1,2
+@a(1)*100-@a(2)*10
;
;
;-----------------------------------------------------------------------------
; The following are sample external functions that make use of
; built-in (internal) AS-EASY-AS functions in their definition.
;-----------------------------------------------------------------------------
;
; Calculate the Exponential of a value
;
COMPLEX1,1
@exp(@a(1))
;
;
; Add the exponential of argument #1 to the
; base 10 logarithm of argument #2
;
COMPLEX2,2
@exp(@a(1))+@log(@a(2))
;
;
; Add the exponential of argument #1, the
; base 10 logarithm or argument #2 and the
; natural garithm of argument #3
;
COMPLEX3,3
@exp(@a(1))+@log(@a(2))+@ln(@A(3))
;
;
; Evaluate the Square Root or the sum of the exponential of
; argument #1, the base 10 logarithm or argument #2 and the
; natural garithm of argument #3
;
COMPLEX4,3
@sqrt(@exp(@a(1))+@log(@a(2))+@ln(@A(3)))
;
;
; A slightly more complex function using internal AS-EASY-AS functions
;
CMP5,5
@sqrt(@exp(@a(1))+@log(@a(2))+@ln(@A(3)))+(@log(@a(4)))^2+@A(5)
;
;
;
;
;-----------------------------------------------------------------------------
; The following are simple, useful functions demonstrating
; the power of this new feature.
;-----------------------------------------------------------------------------
;
; TRIAREA: Area of Triangle given Base - a(1), and Height - a(2)
;
TRIAREA,2
(@a(1)/2)*@a(2)
;
;
; CIRCAREA: Area of circle given the radius
;
CIRCAREA,1
+@a(1)^2*(22/7)
;
;
; INVERSE: The inverse of a value , i.e., 1/X
;
INVERSE,1
1/@A(1)
;
;
; INTDIV: Integer Division Var(1)/Var(2). Var(1) and Var(2) are
; converted to integers before the division!
;
INTDIV,2
@int(@int(@a(1))/@int(@a(2)))
;
;
; RAD2DEG: Converts the user specified angle from
; Radians to Degrees
;
RAD2DEG,1
(@A(1)/@PI)*180
;
;
; DEG2RAD: Converts the user specified angle from
; Degrees to Radians
;
DEG2RAD,1
(@PI*@A(1))/180
;
;
;
; CIRCUM: Calculates the Circumference of a circle given the radius
;
CIRCUM,1
2*@PI*@A(1)
;
;
;
;-----------------------------------------------------------------------------
; The following are useful, Bond Calculation Functions.
;-----------------------------------------------------------------------------
;
; BDISC: Discount Rate for Bond where,
;
; @A(1) = Bond Price
; @A(2) = Bond Redemption
; @A(3) = 360 or 365 (Calendar Conversion)
; @A(4) = Month of Maturity
; @A(5) = Day of Maturity
; @A(6) = Year of Maturity
; @A(7) = Month of Settlement
; @A(8) = Day of Settlement
; @A(9) = Year of Settlement
;
BDISC,9
(1-@A(1)/@A(2))*(@A(3)/(@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8))))
;
;-----------------------------------------------------------------------------
;
; BINTR: Bond Interest Rate where,
;
; @A(1) = Bond Redemption
; @A(2) = Investment
; @A(3) = 360 or 365 (Calendar Conversion)
; @A(4) = Month of Maturity
; @A(5) = Day of Maturity
; @A(6) = Year of Maturity
; @A(7) = Month of Settlement
; @A(8) = Day of Settlement
; @A(9) = Year of Settlement
;
;
BINTR,9
((@A(1)-@A(2))/@A(2))*(@A(3)/(@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8))))
;
;-----------------------------------------------------------------------------
;
;
; BPRICE: Bond Price where,
;
; @A(1) = Bond Face Value
; @A(2) = Discount
; @A(3) = 360 or 365 (Calendar Conversion)
; @A(4) = Month of Maturity
; @A(5) = Day of Maturity
; @A(6) = Year of Maturity
; @A(7) = Month of Settlement
; @A(8) = Day of Settlement
; @A(9) = Year of Settlement
;
BPRICE,9
@A(1)*(1-@A(2)*((@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8)))/@A(3)))
;
;-----------------------------------------------------------------------------
;
;
; BRCV: Bond Redemption Value where,
;
; @A(1) = Investment
; @A(2) = Discount
; @A(3) = 360 or 365 (Calendar Conversion)
; @A(4) = Month of Maturity
; @A(5) = Day of Maturity
; @A(6) = Year of Maturity
; @A(7) = Month of Settlement
; @A(8) = Day of Settlement
; @A(9) = Year of Settlement
;
;
BRCV,9
@A(1)/(1-(@A(2)*((@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8)))/@A(3))))
;
;-----------------------------------------------------------------------------
;
; BYIELD: Bond Yield where,
;
; @A(1) = Price
; @A(2) = Redemption
; @A(3) = 360 or 365 (Calendar Conversion)
; @A(4) = Month of Maturity
; @A(5) = Day of Maturity
; @A(6) = Year of Maturity
; @A(7) = Month of Settlement
; @A(8) = Day of Settlement
; @A(9) = Year of Settlement
;
;
BYIELD,9
((@A(2)/@A(1))-1)*(@A(3)/(@DATE(@A(6),@A(4),@A(5))-@DATE(@A(9),@A(7),@A(8))))
;
;
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;---------------- END OF SAMPLE EXTERNAL FUNCTION FILE -------------------
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------